#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    :  
# @function: 
# @version :


import time
from multiprocessing import Process


# 全局变量
nums = [1, 2]


def work_1():
    for i in range(3, 6):
        nums.append(i)
        time.sleep(1)
        print('进程1获取到的全局变量的值为：', nums)


def work_2():
    print('进程2获取到的全局变量的值为：', nums)


if __name__ == '__main__':
    p1 = Process(target=work_1)
    p2 = Process(target=work_2)

    p1.start()
    p1.join()

    p2.start()

    print('当前主进程获取到的全局变量的值为：', nums)
